package ee.ut.maxorato_macobo.oop.mud.game;

import java.util.TreeMap;

public class NpcTemplatePool {
	private static TreeMap<String, NpcTemplate> templates = new TreeMap<String, NpcTemplate>();
	
	public static boolean registerTemplate(NpcTemplate template) {
		if(templates.containsKey(template.getIdentifier())) return false;
		
		templates.put(template.getIdentifier(), template);
		return true;
	}
	
	public static boolean unregisterTemplate(NpcTemplate template) {
		if(!templates.containsKey(template.getIdentifier())) return false;
		
		templates.remove(template.getIdentifier());
		return true;
	}
	
	public static NpcTemplate findTemplate(String identifier) {
		return templates.get(identifier);
	}
	
	public static TreeMap<String, NpcTemplate> getTemplateList() {
		return templates;
	}
	
	private NpcTemplatePool() {
		
	}
}
